import java.awt.Color;
import java.awt.Graphics;

import javax.swing.JComponent;

public class Pic extends JComponent {

	private static final long serialVersionUID = 1L;
	private Main main;

	public Pic(final Main main) {
		this.main = main;		
	}
	
	@Override
	protected void paintComponent( Graphics g ){ 
		super.paintComponent(g);
		
		String text, textTwo;
		
		if (main.getName() == null || main.getName() == ""){
			text = "Please log in a Character!";
			textTwo = "";
		} else {      
			DecimalFormat df = new DecimalFormat();
			text = "Hello " + main.getName();
			textTwo = "Your server-id is: " + df.format(main.getWorldID());
		}
		
		g.setColor(Color.green);
		g.fillRect(0, 0, 300, 300);
		g.setColor(Color.black);
		g.drawString(text, 5, 10);
		g.drawString(textTwo, 5, 20);
		
		g.dispose();
	}
}